<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/inc::header"/>
<body>
<form class="layui-form" id="customerForm">
    <input name="id" id="id" type="hidden"/>
    <input name="examineeImg" id="examineeImg" type="hidden"/>
    <br/>
    <div class="layui-form-item" style="margin-left: 10%">
        <label class="layui-form-label" style="width: 120px" th:size="20">考生信息</label>
    </div>
    <div class="layui-form-item" style="margin-left: 10%">
        <div class="layui-input-inline" style="margin-left: 15%">
            <div class="layui-upload-list">
                <img class="layui-upload-img" id="img" style="width: 150px;height: 150px">
            </div>
        </div>
        <div class="layui-input-inline" style="width: 60%">
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 120px">考生姓名</label>
                <div class="layui-input-inline">
                    <input type="text" name="examineeName" id="examineeName" autocomplete="off" required
                           class="layui-input">
                </div>
                <label class="layui-form-label" style="width: 120px">性别</label>
                <div class="layui-input-inline">
                    <input type="text" name="sex" id="sex" autocomplete="off" required
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 120px">身份证</label>
                <div class="layui-input-inline">
                    <input type="text" name="idCard" id="idCard" autocomplete="off" required
                           class="layui-input">
                </div>
                <label class="layui-form-label" style="width: 120px">手机号码</label>
                <div class="layui-input-inline">
                    <input type="text" name="account" id="account" autocomplete="off" required
                           class="layui-input">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="margin-left: 10%">
        <label class="layui-form-label" style="width: 120px">考试记录</label>
        <div class="layui-input-inline" style="width: 80%">
            <table class="layui-table" id="grid" lay-filter="grid">
            </table>
        </div>
    </div>
    <button class="layui-btn" id="formSubmit" lay-submit="" lay-filter="formSubmit" style="display: none">立即提交
    </button>
</form>
<script th:replace="/common/inc::incJs"></script>
<style type="text/css">
    .w-e-text-container {
        height: 500px !important;
        width: 700px /*!important是重点，因为原div是行内样式设置的高度300px*/
    }

    .layui-table-header {
        width: 1058px;
    }
</style>
<script>
    var form = layui.form;
    var successCallback;
    var id = getQueryString("id");
    $("#id").val(id);


    //监听提交
    form.on('submit(formSubmit)', function (data) {
        if ($("#productImg").val()) {
            data.field.productInfo = productInfoEditor.txt.html();
            if (id != "") {
                $.post('/backend/security/product/update', data.field, function (res) {
                    if (res.code < 0) {
                        layer.msg(res.message);
                    } else {
                        layer.msg('操作成功');
                        successCallback && successCallback();
                    }
                });
            } else {
                $.post('/backend/security/product/add', data.field, function (res) {
                    if (res.code < 0) {
                        layer.msg(res.message);
                    } else {
                        layer.msg('操作成功');
                        successCallback && successCallback();
                    }
                });
            }
        } else {
            layer.msg('产品图片不能为空');
        }
        return false;
    });

    //初始化加载
    $(function () {
        $.post('/backend/security/examineeInfo/getById', {id: id}, function (res) {
            if (res.code < 0) {
                layer.msg(res.message);
            } else {
                $("form").loadData(res.body);
                $("#img").attr("src", res.body.examineeImg);
                layui.form.render('select');
            }
        });

        var tableIns = createTable({
            url: '/backend/security/examineeRecord/examineeList?id=' + id,
            cols: [[{
                field: 'examineeSubject',
                title: '考试名称',
                width: 150
            },
                {field: 'examineeHallName', title: '考场', width: 120}, {
                    field: 'examineeStartTime',
                    title: '考试开始时间',
                    width: 180
                }, {
                    field: 'examineeEndTime',
                    title: '考试结束时间',
                    width: 180
                }, {
                    field: 'idArrive', title: '是否缺考', width: 120,
                    templet: '#typeTpl'
                }, {field: 'seatNo', title: '座位号', width: 120}, {field: 'entranceTime', title: '入场时间', width: 180}
            ]]
        });
    })
</script>
<script type="text/html" id="typeTpl">
    {{#  if(d.idArrive ===0){ }}
    <span>是</span>
    {{#  } else if(d.idArrive ===1){ }}
    <span>否</span>
    {{#  } }}
</script>
</body>
</html>
